#include <iostream>
int main() {
    int* ptr = nullptr;
    if(ptr != nullptr) {
        *ptr = 10; // 仅在指针非空时才进行内存访问
    } else {
        std::cout << "Null Pointer Exception!" << std::endl;
    }
    return 0;
}